import request from '@/utils/request'

// 查询供应厂商列表
export function listSupplier(query) {
  return request({
    url: '/slope/supplier/list',
    method: 'get',
    params: query
  })
}

// 查询供应厂商详细
export function getSupplier(supplierId) {
  return request({
    url: '/slope/supplier/' + supplierId,
    method: 'get'
  })
}

// 新增供应厂商
export function addSupplier(data) {
  return request({
    url: '/slope/supplier',
    method: 'post',
    data: data
  })
}

// 修改供应厂商
export function updateSupplier(data) {
  return request({
    url: '/slope/supplier/edit',
    method: 'post',
    data: data
  })
}

// 导出供应厂商
export function exportSupplier(query) {
  return request({
    url: '/slope/supplier/export',
    method: 'get',
    params: query
  })
}

// 下载设备模板
export function importTemplate(query) {
  return request({
    url: '/slope/supplier/getExcel',
    method: 'get',
    params: query
  })
}

// 启用供应厂商
export function enableSupplier(supplierId) {
  return request({
    url: '/slope/supplier/enable/' + supplierId,
    method: 'post'
  })
}


// 删除供应厂商
export function deleteSupplier(supplierId) {
  return request({
    url: '/slope/supplier/remove/' + supplierId,
    method: 'post'
  })
}

// 禁用供应厂商
export function disableSupplier(supplierId) {
  return request({
    url: '/slope/supplier/disable/' + supplierId,
    method: 'post'
  })
}

// 没有设置权限的供应厂商列表
export function noRoleListSupplier(query) {
  return request({
    url: '/slope/supplier/noRoleList',
    method: 'get',
    params: query
  })
}

// 检测供应商名字是否重复
export function checkSupplierName(name) {
  return request({
    url: '/slope/supplier/checkSupplierName?supplierName=' + name,
    method: 'get'
  })
}
